package com.example.Student

class Student {

    String name;
    int sub1Marks;
    int sub2Marks;

    def printTotal() {
        println "$name has total marks = " + (sub1Marks + sub2Marks)
    }

    static void main(args) {
        Student student1 = new Student()
        student1.name = "John"
        student1.sub1Marks = 88
        student1.sub2Marks = 77

        student1.printTotal()
        println 'student1\'s name is ' + student1.getName()
        println 'student1\'s sub1Marks is ' + student1.getSub1Marks()
        student1.name = "John1"
        println 'Modify student1\'s name to ' + student1.getName()
        student1.setName("John2")
        println 'Modify student1\'s name to ' + student1.getName()
    }

}